<!-- pass a variable to included page -->
<%@ page import="SSP.*" %>
<%@ page import="java.text.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%  
   String today = null;
   Today t = new Today();
   today = t.getToday();
   request.setAttribute("picture","Service");
   request.setAttribute("title", "Service Order Details");  
   request.setAttribute("header", "Welcome " + 
   		session.getAttribute("firstname") + " " + 
   		session.getAttribute("lastname") + 
   		" : Today is " + today); 
 %>
 <%@ include file="header.jsp"%>
<TD width="850" vAlign="top"> 
<br /><h2>Service Order Details</h2><br />		
<%
int myserviceorderid = Integer.parseInt(request.getParameter("serviceorderid"));
ResultSet rs = null;
String serviceorderid = null;
String serviceorderstatus = null;
String customername = null;
String priority = null;
String servicetype = null;
String opendate = null;
String address1 = null;
String address2 = null;
String CityStateZip = null;
String name = null;
String phone = null;
String email = null;
String equipmentid = null;
String productname = null;
String modality = null;
String problemdescription = null;
String mystate = null;

Dispatcher d = new Dispatcher();
rs = d.getDispatcherSoDetails(myserviceorderid);
while (rs.next()) {
    serviceorderid =  rs.getString("serviceorderid");
    customername = rs.getString("CustomerName");
    serviceorderstatus =  rs.getString("soStatusDescription");
	priority = rs.getString("PriorityDescription");
    servicetype = rs.getString("ServiceTypeDescription");
    opendate = rs.getString("opendate");
    address1 = rs.getString("address1");
    address2 = rs.getString("address2");
    if (address2 == null) {address2 = " ";}
    CityStateZip = rs.getString("CityStateZip");
    name = rs.getString("contactname");
    phone = rs.getString("contactphone");
    email = rs.getString("contactemail");
    equipmentid = rs.getString("equipmentid");
    productname = rs.getString("productname");
    modality = rs.getString("ModalityDescription");
    problemdescription = rs.getString("problemdescription");
    mystate = rs.getString("mystate");
}
rs.close();
d.closeConnection();
%>

<table width=50% border=0>
<tr><td>Service Order No:</td><td><%=serviceorderid%></td></tr>
<tr><td>Customer:</td><td><%=customername%></td></tr>
<tr><td>Problem Description:</td><td><%=problemdescription%></td></tr>	
<tr><td>Priority:</td><td><%=priority%></td></tr>
<tr><td>Service Type:</td><td><%=servicetype%></td></tr>
<tr><td>Date:</td><td><%=opendate%></td></tr>
<tr><td>Contact Name:</td><td><%=name%></td></tr>
<tr><td>Contact Phone:</td><td><%=phone%></td></tr>
<%if (email==null){email="";}%>
<tr><td>Contact Email:</td><td><%=email%></td></tr>
<tr><td>Location:</td><td><%=address1%></td></tr>
<%
if (address2 == " "){ %>
	<tr><td>&nbsp;</td><td><font size=2><%=CityStateZip%></font></td></tr>
<% } 
else {  %>
	<tr><td>&nbsp;</td><td><%=address2%></td></tr>
	<tr><td>&nbsp;</td><td><%=CityStateZip%></td></tr>
{
<% } %>
<tr><td>

<%String myQuery1 = "Select userid, firstname ||' '|| lastname as fullname from users u where roleid = 4 and u.statecode = '"+ mystate + "'";
OraDB myDB = new OraDB();
ResultSet rs1 = null;
System.out.println(myQuery1);
myDB.createConnection();
rs1=myDB.Query(myQuery1); 
String myengineers="";

%>

 <form action=assignengineer.jsp name=assign>
<input type= hidden name=soid value=<%=myserviceorderid%> %>

<select name=engineerlist>

<%

while (rs1.next()) { %>
 		<option value=<%=rs1.getString("userid")%>><%=rs1.getString("fullname")%></option>
 		<%}%>
 
 </select>
     
	 <input type=submit value="Assign"/>
 </form>
 
</table> <%
rs1.close();
myDB.closeConnection();
%> 
